@extends('layouts.default') 
@section('main')
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <script src="{{URL::asset('js/My97DatePicker/')}}/WdatePicker.js"></script> 
    
    </script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a> <a href="{{url('project/index')}}" class="tip-bottom">项目管理</a><a href="{{url('project/info?id='.$photo->project_id)}}" class="tip-bottom">项目信息</a><a href="{{url('project/photo?id='.$photo->project_id)}}" class="tip-bottom">图片管理</a> <a href="#" class="current">图片编辑</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span7" style="width:80%;">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>图片编辑</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form  action="{{url('project/photoupdate')}}" method="post" class="form-horizontal" id="projectForm" >
                                <input type="hidden" name="project_id" value="{{ $photo->project_id }}">
                                <div class="control-group">
                                    <label class="control-label">图片ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$photo->id}}" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图片类型 :</label>
                                    <div class="controls">
                                        <select name="type" id="type">
                                            @foreach($phototype as $val)
                                                <option value="{{$val}}">{{$val}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>



                                <div class="control-group">
                                    <label class="control-label">图片 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="image"
                                            placeholder="图片" />
                                        <a href="javascript:void(0);" id="uploadPhotoBtn" class="icon-picture"  onclick="javascript:openBrowse('uploadPhotoBtn','uploadPhoto');"></a>
                                            <input type="file" id="uploadPhoto" name="myfile" style="display:none"  size="10" onchange="fileUpload('uploadPhoto','image')"/>
                                    </div>
                                </div>

                                
                                <div class="control-group">
                                    <label class="control-label">是否审核通过 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="status" value="1" <?php if($photo->status == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="status" value="0" <?php if($photo->status == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>
                               
                                {{--@endif--}}
                                <div class="form-actions">
                                    <button type="button" class="btn btn-success" id="doSave">确认修改</button>
                                </div>
                            </form>
                        </div>
                        @include('message.flash')
                        @include('errors.list')
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        
        $("#doSave").click(function(){
            
            ajaxRequest($('#projectForm').serializeArray(),$('#projectForm').attr('action'),function(data){
                if(data.status){
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });

       /* $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="0">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });   */

    </script>
@stop
